
echo 'Running swig...'
/usr/local/bin/swig -csharp -c++  -outdir openfixfast  -namespace openfixfast -o OpenFixFAST.cpp ../cpp/openfixfast.i

echo 'Generic bugs'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/openfixfast::c_vpfWrapper//g" OpenFixFAST.cpp000 > OpenFixFAST.cpp

echo '#pragma warning (disable : 4786)' > OpenFixFAST.cpp000
sed s/shouldnotfound//g  OpenFixFAST.cpp >> OpenFixFAST.cpp000
mv OpenFixFAST.cpp000 OpenFixFAST.cpp 

echo '#pragma warning (disable : 4786)' > OpenFixFAST.h000
sed s/shouldnotfound//g OpenFixFAST.h >> OpenFixFAST.h000
mv OpenFixFAST.h000 OpenFixFAST.h

echo '  Fixing CHAR'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/CHAR \*arg1/char \*arg1/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing CHAR'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/(CHAR const/(char const/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing CHAR'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/CHAR temp1/char temp1/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing CHAR'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/(CHAR)/(char)/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000


echo '  Fixing INT'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/INT \*arg1/int \*arg1/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing INT'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/(INT const/(int const/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing INT'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/INT temp1/int temp1/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing INT'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/(INT)/(int)/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000


echo '  Fixing FLOAT'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/FLOAT \*arg1/double \*arg1/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing FLOAT'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/(FLOAT const/(double const/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing FLOAT'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/FLOAT temp1/double temp1/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing FLOAT'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/(FLOAT)/(double)/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000


echo '  Fixing BOOLEAN'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/BOOLEAN \*arg1/bool \*arg1/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing BOOLEAN'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/(BOOLEAN const/(bool const/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing BOOLEAN'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/BOOLEAN temp1/bool temp1/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing BOOLEAN'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/(BOOLEAN)/(bool)/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing CURRENCY'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/CURRENCY \*arg1/std::string \*arg1/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing CURRENCY'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/(CURRENCY const/(std::string const/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing CURRENCY'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/CURRENCY temp1/std::string temp1/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000

echo '  Fixing CURRENCY'
mv OpenFixFAST.cpp OpenFixFAST.cpp000
sed "s/(CURRENCY)/(std::string)/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
rm OpenFixFAST.cpp000


# echo '  Fix new series bugs'
# mv OpenFixFAST.cpp OpenFixFAST.cpp000

# sed "s/SWIGEXPORT void SWIGSTDCALL CSharp_delete_series_t(void \* jarg1)/\\nSWIGEXPORT void \* SWIGSTDCALL CSharp_new_series_t() \\n{ \\n\\tvoid \* jresult ; \\n\\tseries_t \*result = 0 ; \\n\\tresult = (series_t \*)new series_t(); \\n\\tjresult = (void \*)result; \\n\\treturn jresult; \\n} \\nSWIGEXPORT void SWIGSTDCALL CSharp_delete_series_t(void \* jarg1)/g" OpenFixFAST.cpp000 > OpenFixFAST.cpp
# rm OpenFixFAST.cpp000



echo '  Fix warning 4786, 401'
echo #include "stdafx.h" > OpenFixFAST.cpp000
echo #include "Application.h" >> OpenFixFAST.cpp000
echo #include "MessageCracker.h" >> OpenFixFAST.cpp000
echo #include "Values.h" >> OpenFixFAST.cpp000
echo #include "Mutex.h" >> OpenFixFAST.cpp000
echo #pragma warning (disable : 4786) >> OpenFixFAST.cpp000
echo #pragma warning (disable : 401) >> OpenFixFAST.cpp000
sed s/shouldnotfound//g  OpenFixFAST.cpp >> OpenFixFAST.cpp000
mv OpenFixFAST.cpp000 OpenFixFAST.cpp

